|
|
@@ -52,19 +52,20 @@ class Command(CompatibilityBaseCommand):
|
52
|
52
|
last_month += log.filter(ym=lastmonth).count()
|
53
|
53
|
|
54
|
54
|
if m.is_important or (yesterday_num or current_month or last_month):
|
55
|
|
- SalesResponsibilityInfoModelsSaleStatisticInfo.objects.create(
|
|
55
|
+ sale, _ = SalesResponsibilityInfoModelsSaleStatisticInfo.objects.get_or_create(
|
56
|
56
|
brand_id=b.brand_id,
|
57
|
57
|
sr_id=d.sr_id,
|
58
|
58
|
distributor_id=d.distributor_id,
|
59
|
|
- distributor_name=d.distributor_name,
|
60
|
|
- model_id=m.model_id,
|
61
|
|
- model_name=m.model_name,
|
62
|
|
- is_important=m.is_important,
|
|
59
|
+ model_name=m.model_uni_name,
|
63
|
60
|
ymd=day,
|
64
|
|
- yesterday_num=yesterday_num,
|
65
|
|
- current_month=current_month,
|
66
|
|
- last_month=last_month,
|
67
|
61
|
)
|
|
62
|
+ sale.distributor_name = d.distributor_name
|
|
63
|
+ sale.model_id = m.model_id
|
|
64
|
+ sale.is_important = m.is_important
|
|
65
|
+ sale.yesterday_num = yesterday_num
|
|
66
|
+ sale.current_month = current_month
|
|
67
|
+ sale.last_month = last_month
|
|
68
|
+ sale.save()
|
68
|
69
|
|
69
|
70
|
srs = SalesResponsibilityInfo.objects.filter(brand_id=b.brand_id, status=True)
|
70
|
71
|
for s in srs:
|